package com.framework.boc.admin.interceptor;

import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;

import java.io.IOException;

public class BocRestHttpRequestInterceptor implements ClientHttpRequestInterceptor {
    @Override
    public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
        System.out.println("进入拦截器，设置请求头");
        httpRequest.getHeaders().add("userkeyword", "AC1D15122CE23445");
        return clientHttpRequestExecution.execute(httpRequest, bytes);
    }
}
